using UniversalAdmin.Domain.Repositories;

namespace UniversalAdmin.Domain.Interfaces;

public interface IUnitOfWork
{
  // 获取特定仓储
  IUserRepository UserRepository { get; }
  IRoleRepository RoleRepository { get; }
  IMenuRepository MenuRepository { get; }
  ISystemConfigRepository SystemConfigRepository { get; }
  IFileRepository FileRepository { get; }
  IOperationLogRepository OperationLogRepository { get; }
  IRefreshTokenRepository RefreshTokenRepository { get; }
  IArticleRepository Articles { get; }

  // 事务管理
  Task BeginTransactionAsync();
  Task CommitAsync();
  Task RollbackAsync();

  // 保存更改
  Task<int> SaveChangesAsync();

  // 执行原始SQL
  Task ExecuteSqlRawAsync(string sql, params object[] parameters);
}